import { MusicResUrl } from "../Enum";

export default class MusicUtil {
    /**
     * 加载音频资源
     * @param url 
     * @returns 
     */
    public static loadMusic(url: MusicResUrl): Promise<cc.AudioClip | null> {
        return new Promise((resolve, reject) => {
            cc.loader.loadRes(url, cc.AudioClip, (err, audioClip) => {
                if (err) {
                    reject(null)
                    return
                }
                resolve(audioClip)
            })
        })
    }
}